<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>CMS 后台管理工作平台</title>
<style type="text/css">
<!--
body {
	margin-left: 3px;
	margin-top: 0px;
	margin-right: 3px;
	margin-bottom: 0px;
}
.STYLE1 {
	color: #e1e2e3;
	font-size: 12px;
}
.STYLE6 {color: #000000; font-size: 12; }
.STYLE10 {color: #000000; font-size: 12px; }
.STYLE19 {
	color: #344b50;
	font-size: 12px;
}
.STYLE21 {
	font-size: 12px;
	color: #3b6375;
}
.STYLE22 {
	font-size: 12px;
	color: #295568;
}
A:active,A:visited,A:link {
	COLOR: #0629FD;
	TEXT-DECORATION: none
}

A:hover {
	COLOR: #FF6600;
	TEXT-DECORATION: none
}

A.relatelink:active,A.relatelink:visited,A.relatelink:link { 
	color: white;
	TEXT-DECORATION: none
}

A.relatelink:hover {
	COLOR: #FF6600;
	TEXT-DECORATION: none
}

td {
	font-size: 12px;
	color: #003366;
	height:24px
}

.STYLE1 a{
	COLOR: white;
}
.STYLE1 A:active,.STYLE1 A:visited,.STYLE1 A:link {
	COLOR: white;
	TEXT-DECORATION: none
}
.STYLE1 a:hover{
	COLOR: red;
}
-->
</style>

<script type="text/javascript">
	function prom(id,index){
		var price = prompt("请输入消费的金额", "");//将输入的内容赋给变量 name ，
		//这里需要注意的是，prompt有两个参数，前面是提示的话，后面是当对话框出来后，在对话框里的默认值
		if (price){//如果返回的有内容
			if(!isNaN(price)){
				if(index==1){
					price = price * -1;
				}
				window.location.href = '<%=path%>/user/updateUser.action?id='+id+'&price='+price;
			}else{
				alert("请填写正确的数字!");
			}
			
		}
	}
	
	function saveUserForm(){
		window.location.href = '<%=path%>/user/saveUserForm.action';
	}
	
	function updateUser(id){
		window.location.href = '<%=path%>/user/updateUserForm.action?id='+id;
	}
	
	function searchNo(){
		var no = document.getElementById("no").value;
		if(no){
			window.location.href = '<%=path%>/user/findUserByNo.action?cardno='+no;
		}else{
			alert("请填写卡号!");
		}
	}
	
	function showUser(){
		window.location.href = '<%=path%>/user/showUser.action';
	}
	
	function searchlishiNo(no){
		//var no = document.getElementById("lishino").value;
		if(no){
			window.location.href = '<%=path%>/user/lishi.action?cardno='+no;

		}else{
			alert("请填写卡号!");
		}
	}
	function cancelUser(id){
		 if(confirm("你确认要注销该用户?")) {
			 window.location.href = '<%=path%>/user/cancelUser.action?id=' + id;
		}
	}
</script>

</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="24" bgcolor="#353c44"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="6%" height="19" valign="bottom"><div align="center"><img src="images/tb.gif" width="14" height="14" /></div></td>
                <td width="94%" valign="bottom"><span class="STYLE1"> 网站文章信息列表</span></td>
              </tr>
            </table></td>
            <!-- 
            <td><div align="right"><span class="STYLE1">
             &nbsp;&nbsp;<img src="images/add.gif" width="10" height="10" /> <a href="#">添加</a>   
             &nbsp;&nbsp;<img src="images/edit.gif" width="10" height="10" /> <a href="#">发布</a>
             &nbsp; <img src="images/del.gif" width="10" height="10" /> <a href="#">删除</a>    &nbsp;&nbsp;   &nbsp;
             </span><span class="STYLE1"> &nbsp;</span></div></td> -->
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>
    
    <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
      <tr>
        <td width="100" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">卡号</span></div></td>
        <td width="50" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">姓名</span></div></td>
        <td width="50" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">性别</span></div></td>
        <td width="50" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">金额</span></div></td>
        <td width="50" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">开卡日期</span></div></td>
        <td width="70" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">地址</span></div></td>
        <td width="70" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">手机</span></div></td>
        <td width="70" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">身份证</span></div></td>
        <td width="70" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">微信账号</span></div></td>
        <td width="70" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">备注</span></div></td>
        <td width="100" height="20" bgcolor="d3eaef" class="STYLE6" colspan="5"><div align="center"><span class="STYLE10">操作</span></div></td>
      </tr>
      <tr>
     
<c:forEach items="${user}" var="u">
	  <tr>
	   	<td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center">${u.cardno }</div></td>
	   	<td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center">${u.name }</div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><c:choose><c:when test="${u.sex == 0}">男</c:when><c:otherwise>女</c:otherwise></c:choose></div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center">￥<fmt:formatNumber value="${u.money }" pattern="##.##" minFractionDigits="2" /></div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><fmt:formatDate value="${u.date}" pattern="yyyy-MM-dd"/></div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center">${u.address }</div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center">${u.phone }</div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center">${u.idcard }</div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center">${u.webchatid }</div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><c:if test="${u.note!='null'}">${u.note }</c:if></div></td>
   		<td>
   			<input type="button" value="消费" onclick="prom('${u.id }',1);" />
   			<input type="button" value="充值" onclick="prom('${u.id }',2);" />
   			<input type="button" value="修改用户" onclick="updateUser('${u.id }');" />
   			<input type="button" value="注销用户" onclick="cancelUser('${u.id }');" />
   			<input type="button" value="查看消费充值记录" onclick="searchlishiNo('${u.cardno }')">
   		</td>
	  </tr>
</c:forEach>   	
   	<!-- 
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center"><a href="#" title="点击查看和编辑文章">JBPM实例介绍之一</a></div></td>
        <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE21">
        <a href="#" title="点击发布文章">发布</a> | 
        <a href="#" title="点击删除文章">删除</a> |
        <a href="#" title="点击编辑文章">编辑</a>
         -->
        </div></td>
      </tr>
    </table>
    
    
    
    </td>
  </tr>
  <tr>
    <td height="30">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="33%"><div align="left"><span class="STYLE22">&nbsp;&nbsp;&nbsp;&nbsp;共有<strong> 243</strong> 条记录，当前第<strong> 1</strong> 页，共 <strong>10</strong> 页</span></div></td>
        <td width="67%" align=right vAlign="center" noWrap>
				<form action="<c:url value='/user/showUser.action'/>">
		一共${pageNumber}页&nbsp;当前第${curPage}页&nbsp;<a href="<c:url value='/user/showUser.action?pages=1'/>">第一页</a>&nbsp;
		<c:choose>
			<c:when test="${curPage == 1}">
	    	   	上一页
	    	</c:when>
			<c:otherwise>
				<a href="<c:url value='/user/showUser.action?pages=${curPage-1}'/>">上一页</a>
			</c:otherwise>
		</c:choose>
		转到第<input name="pages" type="text" value="${curPage}" size="1"/> <input type="submit" value="页" />
		<c:choose>
			<c:when test="${curPage == pageNumber}">
	    	   	下一页
	    	</c:when>
			<c:otherwise>
				<a href="<c:url value='/user/showUser.action?pages=${curPage+1}'/>">下一页</a>
			</c:otherwise>
		</c:choose>
		<a href="<c:url value='/user/showUser.action?pages=${pageNumber}'/>">最后一页</a>
	</form>
   ${msg}
  	<c:remove var="msg" scope="session"/>
				

      </td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

